import { Menu, BrowserWindow, MenuItem } from 'electron'

export default (mainWindow: BrowserWindow): void => {
  const mainMenuTemplate = [
    new MenuItem({
      label: '刷新',
      role: 'reload',
    }),
    new MenuItem({
      label: '开发控制台',
      role: 'toggleDevTools',
    }),
  ] as Array<MenuItem>

  const menu = Menu.buildFromTemplate(mainMenuTemplate)
  // 右键菜单
  mainWindow.webContents.on('context-menu', () => {
    menu.popup()
  })
}
